package com.bzm.pojo.bzm;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.bzm.pojo.plugins.im.ImChatUserBind;

import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * bzm聊天用户
 * </p>
 *
 * @author hemiao
 * @since 2022-07-12
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class BzmImUser implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * im用户id
     */
    private String userId;

    /**
     * 用户头像
     */
    private String headImgUrl;

    private String username;

    private String phone;

    private String nickname;

    private LocalDateTime createTime;

    private String createId;

    private LocalDateTime updateTime;

    private String updateId;

    private String description;

    /**
     * 登录时间
     */
    private LocalDateTime loginTime;

    private String loginIp;

    /**
     * 登录状态  0、未登录 ，1、登陆中
     */
    private Integer loginStatus;

    private String ipJson;

    private String ipCountry;

    private String ipProvince;

    private String ipCity;

	public ImChatUserBind getToImChatUserBind(BzmImUser imUser) {
		ImChatUserBind userBind = new ImChatUserBind();
		if(imUser!=null) {
			userBind.setUserId(imUser.getUserId());
			userBind.setAvatar(imUser.getHeadImgUrl());
			userBind.setNickname(imUser.getNickname());
			userBind.setLoginTime(imUser.getLoginTime());
		}
		return userBind;
	}


}
